/****************************************************
文件：BridgeModel.cs
作者：UnitySir
邮箱：zouajck@foxmail.com
日期：2021/05/04 10:10:15
功能：Nothing
*****************************************************/

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BridgeModel : MonoBehaviour
{
    private void Start()
    {
        // IRenderEngine renderEngine = new DirectX();
        // Sphere sphere = new Sphere(renderEngine);
        // sphere.Draw();
        //
        // Cube cube = new Cube(renderEngine);
        // cube.Draw();
        //
        // Capsule capsule = new Capsule(renderEngine);
        // capsule.Draw();

        ICharacter character = new SoldierCaptain();

        // character.Weapon = new WeaponRocket();
        // character.Attack(character);
    }
}

public class IGraph
{
    public string name;
    public IRenderEngine renderEngine;

    public IGraph(IRenderEngine renderEngine)
    {
        this.renderEngine = renderEngine;
    }

    public void Draw()
    {
        renderEngine.Render(name);
    }
}

public abstract class IRenderEngine
{
    public abstract void Render(string name);
}


public class Sphere : IGraph
{
    public Sphere(IRenderEngine renderEngine) : base(renderEngine)
    {
        this.name = "Sphere";
    }
    // public string Name { get; private set; } = "Sphere";
    // private OpenGL OpenGL = new OpenGL();
    // private DirectX dx = new DirectX();
    //
    // public void DrawDx()
    // {
    //     dx.Render(Name);
    // }
    //
    // public void Draw()
    // {
    //     OpenGL.Render(Name);
    // }
}

public class Cube : IGraph
{
    public Cube(IRenderEngine renderEngine) : base(renderEngine)
    {
        this.name = "Cube";
    }
    // public string Name { get; private set; } = "Cube";
    // private OpenGL OpenGL = new OpenGL();
    // private DirectX dx = new DirectX();
    //
    // public void DrawDx()
    // {
    //     dx.Render(Name);
    // }
    //
    // public void Draw()
    // {
    //     OpenGL.Render(Name);
    // }
}

public class Capsule : IGraph
{
    public Capsule(IRenderEngine renderEngine) : base(renderEngine)
    {
        name = "Capsule";
    }
    // public string Name { get; private set; } = "Capsule";
    // private OpenGL OpenGL = new OpenGL();
    // private DirectX dx = new DirectX();
    //
    // public void DrawDx()
    // {
    //     dx.Render(Name);
    // }
    //
    // public void Draw()
    // {
    //     OpenGL.Render(Name);
    // }
}

public class OpenGL : IRenderEngine
{
    // public void Render(string name)
    // {
    //     Debug.Log($"OpenGL绘制出来了:{name}");
    // }

    public override void Render(string name)
    {
        Debug.Log($"OpenGL绘制出来了:{name}");
    }
}

public class DirectX : IRenderEngine
{
    // public void Render(string name)
    // {
    //     Debug.Log($"DirectX绘制出来了:{name}");
    // }

    public override void Render(string name)
    {
        Debug.Log($"DirectX绘制出来了:{name}");
    }
}